package Work0513;

public class Triangle extends Diagram {
	private double b;
	private double c;

	public Triangle(double a, double b, double c) {
		super(a);
		this.b = b;
		this.c = c;

	}

	public void getLength() {
		if (getA() + b > c && getA() + c > b && b + c > getA()) {
			double length = getA() + b + c;
			System.out.println("该三角形的周长为" + length);
			return;
		}
		System.out.println("该三条边无法组成三角形");
	}

	public void getArea() {
		if (getA() + b > c && getA() + c > b && b + c > getA()) {
			double p = 1.0 / 2 * (getA() + b + c);
			double area = Math.sqrt((p) * (p - getA()) * (p - b) * (p - c));
			System.out.println("该三角形的面积为:" + area);
			return;
		}
		System.out.println("该三条边无法组成三角形");
	}

}
